﻿using System;
using System.Collections.Generic;
using System.Data;
using Microsoft.Reporting.WebForms;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace IMIS_ERP.Web.Factory_Info
{
    public partial class Report_Agent_FactoryFee : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Pub_Useful.CheckRight.checkRight("ag_0|ag_1");
                Data_Bind("2010-1-1","2110-1-1");
            }
        }

        private void Data_Bind(string strTime1,string strTime2)
        {
            IMIS_ERP.BLL.Factory_Info bll = new BLL.Factory_Info();
            DataSet ds = bll.GetFeeRpt(Session["aiProvince"].ToString(), "in(" + IMIS_ERP.BLL.Assistant.StrToQuotation(Session["aiArea"].ToString()) + ")", strTime1, strTime2);
            ReportDataSource rds = new ReportDataSource("ds", ds.Tables[0]);
            this.RV.LocalReport.DataSources.Clear();
            this.RV.LocalReport.DataSources.Add(rds);
            this.RV.DataBind();
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string time1 = "2010-1-1", time2 = "2110-1-1";
            if (txthTime1.Text != "")
            {
                time1 = txthTime1.Text.Trim() + " 00:00:00";
            }
            if (txthTime2.Text != "")
            {
                time2 = txthTime2.Text.Trim() + " 23:59:59";
            }
            Data_Bind(time1, time2);
        }
    }
}